# Maintainer: @naveen521kk on Github, Naveen M K <naveen521kk@gmail.com>
_pyname=path.py
_realname=path.py
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=12.5.0
pkgrel=3
pkgdesc="A module wrapper for os.path (mingw-w64)"
url="https://pypi.org/project/path.py/"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python-path")
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-python-setuptools"
   "${MINGW_PACKAGE_PREFIX}-python-setuptools-scm"
 )
source=("${_pyname}-${pkgver}.tar.gz::https://pypi.org/packages/source/${_pyname::1}/${_pyname}/${_pyname}-${pkgver}.tar.gz")
sha512sums=('f0adba468be0d4db028a32f688d67e9c23e97293f135fcafb6fe373d0d50b0ec38a457d54e9169376e9c762f0191eb22f8262ce921a26107455dce462400594d')

prepare() {
  rm -rf python-build-${CARCH}
  cp -r "${_pyname//_/-}-$pkgver" "python-build-${CARCH}"
  export SETUPTOOLS_SCM_PRETEND_VERSION=${pkgver}
}

build() {
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd "${srcdir}/python-build-${CARCH}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1 --skip-build
}
